/**
 * SKPipeline.h
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/06/21
 */
#pragma once
#include "PLMacro.h"
#include "Registration.h"
#include "Timeline.h"
#include "Frame.h"
#include "SKObjectMove.h"
#include "SKObjectRotate.h"
#include "VecBall.h"

#define CALLPIPELINE(_type, _Interface, _DefType, _defObj, _defInterName) \
	{ CSKFactory CF; \
	ISKPipeline* pSK = CF.CreateInstance(_type); \
	CObjectBlock<ISKPipeline> oBox(pSK, true, false); \
	CSKDistributor* pDis = dynamic_cast<CSKDistributor*>(pSK); \
	pDis->AddBlockInfo<_DefType>(_defInterName, _defObj, false, false); \
	oBox->_Interface(); }


class CSKInfo
{
public:
	CSKInfo();
	virtual ~CSKInfo();

	CTimeline*						GetTimeline()
	{ return &m_oTimeline; }

	Streams*						GetStreams()
	{ return &m_streams; }

	long							GetUnitFrameCount()
	{ return m_UnitFrameCount; }
	void							SetUnitFrameCount(long lCount)
	{ m_UnitFrameCount = lCount; }

	CSKObjectMoveObject&			GetMoveDefinition() { return m_oMove; }

	CSKObjectRotateObject&			GetRotateDefinition() { return m_oRotate; }

	long&							GetTime() { return m_lTime; }

	CVecBall*						GetBall() { return &m_ball; }

	void							Reset();

private:
	CString							m_strFilePath;
	CTimeline						m_oTimeline;
	Streams							m_streams;
	Frames							m_Frames;
	long							m_UnitFrameCount;
	CSKObjectMoveObject				m_oMove;
	CSKObjectRotateObject			m_oRotate;
	long							m_lTime;
	CVecBall						m_ball;
};

DECLARE_BASE_GINTERFACE(ISKPipeline)
	GINTERFACE_BASE_PART(OnExecute)
END_BASE_DECLARE

DECLARE_GINTERFACE(CSKDistributor, ISKPipeline)
	GINTERFACE_PART(OnExecute)
END_DECLARE



class CSKFactory
{
public:
	CSKFactory();
	virtual ~CSKFactory();

	enum SKOperType
	{
		eNone = 0,
		eLoadFile,
		eCopyKnot,
		eSolveAll,
		eUpdateTree,
		eMoveKnot,
		eRotateNode,
		eInvokeAnimation,
		eSelectNode,
		eDragNode,
	};


// method
	virtual ISKPipeline*			CreateInstance(SKOperType eType);


private:
	ISKPipeline*					m_pSKInstance;
};